<template>
  <div>
    <Modal title="选择归档人" v-model="fileModal" @on-ok="comfirmFile" @on-cancel="fileCancel">
      <Select v-model="fileMan">
        <Option v-for="(item,index) in backFileList" :value="item.id" :key="index">{{item.name}}</Option>
      </Select>
    </Modal>
    <Modal title="撤销纸质归档" v-model="backPaper" @on-ok="chancelPaper">
      <p>是否确认撤销纸质归档？</p>
    </Modal>
    <Modal title="撤销电子归档" v-model="backElect" @on-ok="chancelElect">
      <p>是否确认撤销电子归档？</p>
    </Modal>
    <Modal title="添加备注" v-model="remarkModal" @on-ok="comfirmRemark" @on-cancel="remarkCancel">
      <Input placeholder="请填写备注" v-model="remark" />
    </Modal>
    <Modal title="添加档案号" v-model="numberModal" @on-ok="comfirmNumber" @on-cancel="numberCancel">
      <Input placeholder="请填写档案号" v-model="number" />
    </Modal>
    <div class="top-button-group">
      <Button type="success" @click="exportProject" :disabled="exportBton">导出项目</Button>
      <Button type="success" @click="exportTask" :disabled="exportBton">导出任务单</Button>
      <Button type="success" @click="exportGrade" :disabled="exportBton">导出业绩</Button>
    </div>
    <div class="search-bar">
      <div class="search-block">
        <span>承接部门:</span>
        <SelectTree
          :props="props"
          :options="dataTree"
          :value="valueId"
          :accordion="isAccordion"
          @getValue="getValue($event)"
        />
      </div>
      <div class="search-block">
        <span>承接人员:</span>
        <Select
          ref="myperson"
          v-model="model1"
          style="width:200px"
          @on-change="getperId($event)"
          :label-in-value="true"
          :disabled="easySearchBton"
        >
          <Option v-for="item in personName" :value="item.id" :key="item.id">{{ item.name }}</Option>
        </Select>
      </div>
      <div class="search-block">
        <span>年份:</span>
        <Select
          v-model="model2"
          :disabled="easySearchBton"
          @on-change="getyear($event)"
          :label-in-value="true"
        >
          <Option v-for="item in yearName" :value="item.id" :key="item.id">{{ item.name }}</Option>
        </Select>
      </div>
      <Button type="primary" @click="getNewData" :disabled="easySearchBton">搜索</Button>
      <div class="senior-search-block">
        <Button v-if="clearHigh" type="warning" @click="HighClear">清除高级条件</Button>
        <Poptip trigger="focus" content="包含高级查询内容">
          <Input class="search-content" v-model="keyword" :disabled="highWinButton" />
        </Poptip>
        <Button type="default" @click="OpenhihgLevelSearch" :disabled="highWinButton">高级查询</Button>

        <Button type="primary" style @click="hihgLevelSearch" :disabled="highSearchBton">搜索</Button>
      </div>
    </div>
    <div>
      <Table
        height="500"
        border
        :columns="columns"
        :data="data"
        @on-selection-change="selectChange"
      ></Table>
    </div>
    <br />
    <div>
      <Page :total="totalDataNo" @on-change="getpageNum" />
    </div>

    <transition name="bidding-detail">
      <div class="bidding-block" v-if="fileDtail">
        <div class="bidding-block-top">
          <div class="bidding-block-close" @click="closefiledtail">
            <!--左上角关闭动作-->
            <Icon type="md-close" />
          </div>
          <span>项目详情</span>
        </div>
        <div class="undertake-title">
          <button class="undertake-title" @click.prevent="which='easynews'">项目基本信息</button>
          <button class="undertake-title" @click.prevent="which='authorizenews'">编制信息</button>
          <button class="undertake-title" @click.prevent="which='finacenews'">财务信息</button>
          <button class="undertake-title" @click.prevent="which='projectprogress'">项目进展</button>
        </div>
        <keep-alive>
          <component v-bind:is="which" :callbackdata="callbackdata" :callbackState="callbackState"></component>
        </keep-alive>
        <div>
          <Button type="primary" @click="closefiledtail">确定</Button>
        </div>
      </div>
    </transition>
    <transition name="bidding-detail">
      <div class="bidding-block" v-if="fileHigh">
        <Form ref="formHigh" :rules="ruleHigh" :model="equalConditions" :label-width="150">
          <div class="bidding-block-top">
            <div class="bidding-block-close" @click="cancelAdd">
              <!--左上角关闭动作-->
              <Icon type="md-close" />
            </div>
            <span>高级查询</span>
          </div>
          <div>
            <div class="bidding-body">
              <div class="bidding-content">
                <div>
                  <div class="bidding-item">
                    <FormItem label="审批日期范围从：">
                      <DatePicker type="date" v-model="rangeConditions[0].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[0].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="项目名称：" prop="name">
                      <Input class="bidding-item-input" v-model="equalConditions.name" />
                    </FormItem>
                  </div>
                </div>
                <div>
                  <div class="bidding-item">
                    <FormItem label="合同日期范围从：">
                      <DatePicker type="date" v-model="rangeConditions[1].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[1].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="项目类别：">
                      <Select
                        v-model="equalConditions.type"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in proType"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="项目登记日期从：">
                      <DatePicker type="date" v-model="rangeConditions[2].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[2].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="归档人员：">
                      <Select
                        v-model="spBackFile"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in backFileList"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="电子归档日期从：">
                      <DatePicker type="date" v-model="rangeConditions[3].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[3].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="承接人员：">
                      <Select
                        v-model="equalConditions.undertakePersonId"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in allPeo"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>
                <div>
                  <div class="bidding-item">
                    <FormItem label="纸质归档日期从：">
                      <DatePicker type="date" v-model="rangeConditions[4].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[4].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="完成部门：">
                      <Select
                        v-model="equalConditions.finishDepartmentId"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in dptList"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>
                <div>
                  <div class="bidding-item">
                    <FormItem label="盖章日期范围从：">
                      <DatePicker type="date" v-model="rangeConditions[5].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[5].end" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="审批部门：" prop="auditDepartment">
                      <Input class="bidding-item-input" v-model="equalConditions.auditDepartment" />
                    </FormItem>
                  </div>
                </div>
                <div>
                  <div class="bidding-item">
                    <FormItem label="审批文号录入日期范围：">
                      <DatePicker type="date" v-model="rangeConditions[6].sta" />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <span>至</span>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="50">
                      <DatePicker type="date" v-model="rangeConditions[6].end" />
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="所属地区：">
                      <Select
                        v-model="equalConditions.province"
                        style="width:187px"
                        @on-change="choseProvince"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in province"
                          :value="item.value"
                          :key="item.id"
                        >{{ item.value }}</Option>
                      </Select>
                      <!-- <Input class="bidding-item-input" v-model="equalConditions.province"/> -->
                    </FormItem>
                  </div>

                  <div class="bidding-item">
                    <FormItem :label-width="115">
                      <Select
                        v-model="equalConditions.city"
                        style="width:187px"
                        @on-change="choseCity"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in shi1"
                          :value="item.value"
                          :key="item.id"
                        >{{ item.value }}</Option>
                      </Select>
                      <!-- <Input class="bidding-item-input" v-model="equalConditions.city"/> -->
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem>
                      <Select
                        v-model="equalConditions.area"
                        style="width:200px"
                        @on-change="choseBlock"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in qu1"
                          :value="item.value"
                          :key="item.id"
                        >{{ item.value }}</Option>
                      </Select>
                      <!-- <Input class="bidding-item-input" v-model="equalConditions.area"/> -->
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="任务单编号：" prop="taskNumber">
                      <Input
                        style="width:187px"
                        class="bidding-item-input"
                        v-model="equalConditions.taskNumber"
                      />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="行业类别：" :label-width="115">
                      <Select
                        v-model="equalConditions.industryType"
                        clearable
                        style="width:187px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in carerType"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>

                  <div class="bidding-item">
                    <FormItem label="合同归属单位：">
                      <Select
                        v-model="equalConditions.contractOrigin"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in contactOrgOption"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="盖章状态：">
                      <Select
                        v-model="equalConditions.hasUsualSealed"
                        clearable
                        style="width:187px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in sealOption"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="归档状态：" :label-width="115">
                      <Select
                        v-model="equalConditions.hasArchived"
                        clearable
                        style="width:187px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in backFileOption"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>

                  <div class="bidding-item">
                    <FormItem label="合同有无：">
                      <Select
                        v-model="equalConditions.hasContract"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in ifContactOption"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>

                <div>
                  <div class="bidding-item">
                    <FormItem label="编制人员：">
                      <Select
                        v-model="equalConditions.editPersonId"
                        clearable
                        style="width:187px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in editPerList"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem :label-width="115" label="建设单位：" prop="developmentOrganization">
                      <Input
                        style="width:187px"
                        class="bidding-item-input"
                        v-model="equalConditions.developmentOrganization"
                      />
                    </FormItem>
                  </div>
                  <div class="bidding-item">
                    <FormItem label="项目负责人：">
                      <Select
                        v-model="equalConditions.principleId"
                        clearable
                        style="width:200px"
                        :label-in-value="true"
                      >
                        <Option
                          v-for="item in allPeo"
                          :value="item.id"
                          :key="item.id"
                        >{{ item.name }}</Option>
                      </Select>
                    </FormItem>
                  </div>
                </div>

                <div>
                  <Button type="primary" @click="checkAdd('formHigh')">确定</Button>
                  <Button @click="cancelAdd">取消</Button>
                </div>
              </div>
            </div>
          </div>
        </Form>
      </div>
    </transition>
  </div>
</template>

<script>
import axios from "axios";
import SelectTree from "../../components/treeSelect.vue";
export default {
  components: {
    SelectTree
  },
  data() {
    //不含空格 非必填
    const validateSpace = (rule, value, callback) => {
      if (value) {
        const res = this.common.judgeSpachs(value);
        if (res === -1) {
          callback(new Error("不能含有空格"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //数字+汉字+字母  非必填
    const validateLenNoCHLetter = (rule, value, callback) => {
      if (value != "") {
        const res = this.common.judgeNumberInput(value);
        if (res === -1) {
          callback(new Error("输入只能是汉字、英文或数字符号"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    return {
      row: {},
      pageNum: 1,
      pageSize: 10,
      modelId: 6,

      totalDataNo: null, //总共的数据个数

      //处理权限disabled
      exportBton: true,
      easySearchBton: true,
      highWinButton: true,
      highSearchBton: true,
      jurisdiction: null, //当前用户的权限
      jurisdictionNo: null, //1标识只有承接，2表示只有管理，3表示都有

      ruleHigh: {
        developmentOrganization: [
          //建设单位 数+英+汉
          { required: false, validator: validateLenNoCHLetter, trigger: "blur" }
        ],
        name: [
          //项目名称
          { required: false, validator: validateLenNoCHLetter, trigger: "blur" }
        ],
        taskNumber: [
          { required: false, validator: validateSpace, trigger: "blur" }
        ],
        auditDepartment: [
          { required: false, validator: validateLenNoCHLetter, trigger: "blur" }
        ]
      },
      //树型select********************************
      isClearable: true, // 可清空
      isAccordion: true, // 可收起
      valueId: 0, // 查询部门ID
      valueId2: 0,
      props: {
        // 配置项（必选）
        value: "id",
        label: "name",
        children: "children"
        // disabled:true
      },
      //第一个界面的查询*****************
      personName: [{ id: 0, name: "全部" }], //承接人员数组
      model1: 0, //承接人员ID
      dataTree: [], //部门树
      perNo: 0, //在拿人员的时候定义的一共的页数
      yearName: [], //年份数组
      model2: 0, //年份ID
      nowyear: {}, //当前年

      select1: null,
      select2: null,
      select3: null,

      fileDtail: false, //打开查看详情
      which: "easynews",
      callbackdata: {}, //返回数据
      callbackState: {},

      remarkModal: false, //备注Modal
      remark: "",
      fileModal: false, //归档Modal
      fileModal1: false, //归档Modal
      backPaper: false,
      backElect: false,
      isPaper: false, //区分是否为纸质归档或电子归档
      fileMan: null, //被选中的纸质归档人ID
      fileMan1: null, //被选中的电子归档人ID
      fileManList: [], //归档人列表
      numberModal: false, //添加档案号Modal
      number: "", //档案号
      columns: [
        {
          type: "selection",
          width: 60,
          align: "center",
          fixed: "left"
        },
        {
          title: "序号",
          width: 100,
          key: "id",
          fixed: "left"
        },
        {
          title: "状态",
          width: 120,
          key: "state"
        },
        // {
        //   title: "归档状态",
        //   width: 85,
        //   key: "ifedit",
        //   fixed: "right",
        //   render: (h, params) => {
        //     let st = params.row.state;
        //     let paper = params.row.paperyArchiverId;
        //     let elect = params.row.electricArchiverId;
        //     if (st == 127 && paper != 0 && elect != 0) {
        //       return h("Dropdown", [
        //         h("Button", { props: { type: "error" } }, "归")
        //       ]);
        //     }
        //   }
        // },
        {
          title: "操作",
          fixed: "right",
          width: 120,
          render: (h, params) => {
            let st = params.row.state;
            let paper = params.row.paperyArchiverId;
            let elect = params.row.electricArchiverId;
            let paperTab = {};
            let electTab = {};
            let paperFlag = 0;
            let electFlag = 0;
            let detailBton = true;
            let paperBton = true;
            let electBton = true;
            let remarkBton = true;
            let fileNoBton = true;
            if (this.jurisdictionNo >= 1) {
              detailBton = false;
            }
            if (paper == 0) {
              paperTab = "纸质版归档";
              if (this.jurisdictionNo == 1 || this.jurisdictionNo == 3) {
                paperBton = false;
              }
            } else {
              paperTab = "撤销纸质归档";
              paperFlag = 1;
              if (this.jurisdictionNo == 2 || this.jurisdictionNo == 3) {
                paperBton = false;
              }
            }
            if (elect == 0) {
              electTab = "电子版归档";
              if (this.jurisdictionNo == 1 || this.jurisdictionNo == 3) {
                electBton = false;
              }
            } else {
              electTab = "撤销电子归档";
              electFlag = 1;
              if (this.jurisdictionNo == 2 || this.jurisdictionNo == 3) {
                electBton = false;
              }
            }
            if (this.jurisdictionNo == 1 || this.jurisdictionNo == 3) {
              remarkBton = false;
            }
            if (this.jurisdictionNo == 1 || this.jurisdictionNo == 3) {
              fileNoBton = false;
            }
            if (st == 127 && paper != 0 && elect != 0) {
              return h("Badge", { props: { text: "归", offset: [13, 0] } }, [
                h(
                  "Dropdown",
                  {
                    on: {
                      "on-click": name => {
                        let rowData = params.row;
                        let id = rowData.id;
                        if (name == "read") {
                          this.row = id;
                          this.fileDtail = true;
                          let realState = st;
                          if ((st = 127)) {
                            if (paper == 0 || elect == 0) {
                              realState = 63;
                            }
                          }
                          this.setBackdata(realState);
                        } else if (name == "paperFile") {
                          //点击纸质版归档
                          this.row = id;
                          if (paperFlag == 0) {
                            this.isPaper = true;
                            this.fileModal = true;
                          } else {
                            this.backPaper = true;
                          }
                        } else if (name == "electricFile") {
                          //点击电子版归档
                          this.row = id;
                          if (electFlag == 0) {
                            this.isPaper = false;
                            this.fileModal = true;
                          } else {
                            this.backElect = true;
                          }
                          // this.isPaper = false;
                          // this.fileModal = true;
                        } else if (name == "remark") {
                          //点击添加备注
                          this.row = id;
                          this.remarkModal = true;
                        } else if (name == "fileNumber") {
                          //点击添加档案号
                          this.row = id;
                          this.numberModal = true;
                        }
                      }
                    },
                    props: {
                      transfer: true
                    }
                  },
                  [
                    h(
                      "Button",
                      {
                        props: {
                          type: "primary"
                        }
                      },
                      "操作>>"
                    ),
                    h(
                      "DropdownMenu",
                      {
                        slot: "list"
                      },
                      [
                        h(
                          "DropdownItem",
                          {
                            props: {
                              name: "read",
                              disabled: detailBton
                            }
                          },
                          "查看详情"
                        ),
                        h(
                          "DropdownItem",
                          {
                            props: {
                              name: "paperFile",
                              disabled: paperBton
                            }
                          },
                          paperTab
                        ),
                        h(
                          "DropdownItem",
                          {
                            props: {
                              name: "electricFile",
                              disabled: electBton
                            }
                          },
                          electTab
                        ),
                        h(
                          "DropdownItem",
                          {
                            props: {
                              name: "remark",
                              disabled: remarkBton
                            }
                          },
                          "添加备注"
                        ),
                        h(
                          "DropdownItem",
                          {
                            props: {
                              name: "fileNumber",
                              disabled: fileNoBton
                            }
                          },
                          "添加档案号"
                        )
                      ]
                    )
                  ]
                )
              ]);
            } else {
              return h(
                "Dropdown",
                {
                  on: {
                    "on-click": name => {
                      let rowData = params.row;
                      let id = rowData.id;
                      if (name == "read") {
                        this.row = id;
                        this.fileDtail = true;
                        let realState = st;
                        if ((st = 127)) {
                          if (paper == 0 || elect == 0) {
                            realState = 63;
                          }
                        }
                        this.setBackdata(realState);
                      } else if (name == "paperFile") {
                        //点击纸质版归档
                        this.row = id;
                        if (paperFlag == 0) {
                          this.isPaper = true;
                          this.fileModal = true;
                        } else {
                          this.backPaper = true;
                        }
                      } else if (name == "electricFile") {
                        //点击电子版归档
                        this.row = id;
                        if (electFlag == 0) {
                          this.isPaper = false;
                          this.fileModal = true;
                        } else {
                          this.backElect = true;
                        }
                        // this.isPaper = false;
                        // this.fileModal = true;
                      } else if (name == "remark") {
                        //点击添加备注
                        this.row = id;
                        this.remarkModal = true;
                      } else if (name == "fileNumber") {
                        //点击添加档案号
                        this.row = id;
                        this.numberModal = true;
                      }
                    }
                  },
                  props: {
                    transfer: true
                  }
                },
                [
                  h(
                    "Button",
                    {
                      props: {
                        type: "primary"
                      }
                    },
                    "操作>>"
                  ),
                  h(
                    "DropdownMenu",
                    {
                      slot: "list"
                    },
                    [
                      h(
                        "DropdownItem",
                        {
                          props: {
                            name: "read",
                            disabled: detailBton
                          }
                        },
                        "查看详情"
                      ),
                      h(
                        "DropdownItem",
                        {
                          props: {
                            name: "paperFile",
                            disabled: paperBton
                          }
                        },
                        paperTab
                      ),
                      h(
                        "DropdownItem",
                        {
                          props: {
                            name: "electricFile",
                            disabled: electBton
                          }
                        },
                        electTab
                      ),
                      h(
                        "DropdownItem",
                        {
                          props: {
                            name: "remark",
                            disabled: remarkBton
                          }
                        },
                        "添加备注"
                      ),
                      h(
                        "DropdownItem",
                        {
                          props: {
                            name: "fileNumber",
                            disabled: fileNoBton
                          }
                        },
                        "添加档案号"
                      )
                    ]
                  )
                ]
              );
            }
          }
        }
      ],
      data: [],

      allPeo: [], //所有人的名单
      allPeoPages: null,
      proType: [], //项目类别名单
      editPeo: [], //项目编制人员名单
      dptList: [], //所有部门列表
      carerType: [], //所有行业类别
      editPerList: [], //编制权限人名单
      backFileList: [], //归档人名单
      ////////////////////////////////////////////
      fileHigh: false,
      clearHigh: false,

      equalConditions: {
        //单个字段list
        name: null, //项目名称---
        type: null, //项目类别---
        undertakePersonId: null, //承接人id----
        finishDepartmentId: null, //完成部门----
        auditDepartment: null, //审批部门-----
        province: null, //省---
        city: null, //市---
        area: null, //区---
        taskNumber: null, //任务单编号-----
        industryType: null, //行业类别---
        contractOrigin: null, //合同归属单位-----
        hasUsualSealed: null, //盖章状态---
        hasArchived: null, //归档状态---
        hasContract: null, //合同有无---
        editPersonId: null, //编制人员id---
        developmentOrganization: null, //建设单位---
        principleId: null //负责人id

        //共17个
      },
      rangeConditions: [
        //传给后端的时间，或金额字段
        {
          field: "auditDate",
          sta: null,
          end: null
        },
        {
          field: "contractDate",
          sta: null,
          end: null
        },
        {
          field: "registDate",
          sta: null,
          end: null
        },
        {
          field: "electricArchiveDate",
          sta: null,
          end: null
        },
        {
          field: "paperyArchiveDate",
          sta: null,
          end: null
        },
        {
          field: "usualSealDate",
          sta: null,
          end: null
        },
        {
          field: "auditNumberInputDate",
          sta: null,
          end: null
        }
      ],
      specialConditions: [], //传给后端的特殊字段

      spBackFile: null, //归档人id
      //  spAccount:null,//结算

      contactOrgOption: [
        //合同归属
        {
          id: "学校",
          name: "学校"
        },
        {
          id: "公司",
          name: "公司"
        }
      ],
      collecOption: [
        //收款状态
        {
          id: "collectionAmount=0",
          name: "尚无收款"
        },
        {
          id: "collectionAmount=fund",
          name: "已收款"
        },
        {
          id: "collectionAmount>0 and collectionAmount<fund",
          name: "部分收款"
        },
        {
          id: "collectionAmount=0 or collectionAmount<fund",
          name: "尚无收款及部分收款"
        },
        {
          id: "collectionAmount>0",
          name: "已收款及部分收款"
        }
      ],
      sealOption: [
        //盖章状态
        {
          id: 0,
          name: "未盖章"
        },
        {
          id: 1,
          name: "已盖章"
        }
      ],
      invoiceOption: [
        //发票状态
        {
          id: "invoiceAmount=0",
          name: "发票未开"
        },

        {
          id: "invoiceAmount>0 and invoiceAmount<fund",
          name: "发票部分开"
        },
        {
          id: "invoiceAmount>0 and invoiceAmount<=fund",
          name: "发票已开+部分开"
        },
        {
          id: "invoiceAmount=0 or (invoiceAmount > 0 and invoiceAmount<fund)",
          name: "发票未开+部分开"
        },
        {
          id: "invoiceAmount=fund and invoiceAmount!=0",
          name: "发票已开"
        }
      ],
      rewardOption: [
        //奖金状态
        {
          id: "rewardAmount=0",
          name: "尚无奖金"
        },
        {
          id: "rewardAmount=collectionAmount and rewardAmount!=0",
          name: "奖金等于收款"
        },
        {
          id: "rewardAmount>collectionAmount",
          name: "奖金多于收款"
        },
        {
          id: "rewardAmount<collectionAmount",
          name: "奖金少于收款"
        },
        {
          id: "rewardAmount<collectionAmount or rewardAmount=0",
          name: "尚无奖金且奖金少于收款"
        }
      ],
      ifContactOption: [
        //合同有无
        {
          id: 0,
          name: "无合同"
        },
        {
          id: 1,
          name: "有合同"
        }
      ],
      outputOption: [
        //业务开支
        {
          id: 0,
          name: "无"
        },
        {
          id: 1,
          name: "有"
        },
        {
          id: 2,
          name: "未处理"
        }
      ],
      contactStateOption: [
        //项目状态
        {
          id: 1,
          name: "正常"
        },
        {
          id: 0,
          name: "废弃"
        }
      ],
      backFileOption: [
        //归档状态
        {
          id: 1,
          name: "已归档"
        },
        {
          id: 0,
          name: "未归档"
        }
      ],
      accountOption: [
        {
          id: "settlementAmount=fund",
          name: "已结算"
        },
        {
          id: "settlementAmount<fund and settlementAmount <> 0",
          name: "部分结算"
        },
        {
          id: "settlementAmount=0",
          name: "未结算"
        }
      ],
      ids: [],
      selectId: [],
      keyword: null,
      undertakeDPListName: null,
      undertakePRListName: null,
      regDate: null,
      rangeTag: null, //是否是全院
      totalHigh: null, //全院个数
      mapJson: this.IP.IP + "/map.json",
      province: "",
      sheng: "",
      shi: "",
      shi1: [],
      qu: "",
      qu1: [],
      city: "",
      block: "",
      corse1: {
        label: null
      },
      corse2: {
        label: null
      },
      corse3: {
        label: null
      }
    };
  },
  beforeMount() {
    this.getNewData(); //产生表信息
    this.getcolumns(); //产生表头
    this.getdepartments(); //得到部门的name和ID
    this.getNowYear();
    this.getproType(); //项目类别
    this.getCarerType(); //行业类别
    this.getEditpersonList(); //编制人员
    this.getAllPeo(); //得到所有人
    this.getBackFilePeo(); //得到归档权限人名单
    this.getJurisdiction(); //获得当前用户的权限
    this.getCityData();
    //console.log(this.valueId);
    //console.log(this.model1);
    //console.log(this.model2);
    //console.log(this.totalDataNo);
  },
  methods: {
    // 选省
    choseProvince: function(e) {
      // //console.log("111");
      // //console.log(e);
      for (var index2 in this.province) {
        if (e.label === this.province[index2].value) {
          this.shi1 = this.province[index2].children;
          this.shi = this.province[index2].children[0].value;
          this.qu1 = this.province[index2].children[0].children;
          this.qu = this.province[index2].children[0].children[0].value;
          this.E = this.qu1[0].id;
        }
      }
    },
    // 选市
    choseCity: function(e) {
      for (var index3 in this.city) {
        if (e.label === this.city[index3].value) {
          this.qu1 = this.city[index3].children;
          this.qu = this.city[index3].children[0].value;
          this.E = this.qu1[0].id;
          // //console.log(this.E)
        }
      }
    },
    // 选区
    choseBlock: function(e) {
      this.E = e.label;
      // //console.log(this.E)
    },
    getCityData: function() {
      var that = this;
      axios
        .get(this.mapJson)
        .then(function(response) {
          if (response.status == 200) {
            var data = response.data;
            that.province = [];
            that.city = [];
            that.block = [];
            // 省市区数据分类
            for (var item in data) {
              if (item.match(/0000$/)) {
                //省
                that.province.push({
                  id: item,
                  value: data[item],
                  children: []
                });
              } else if (item.match(/00$/)) {
                //市
                that.city.push({ id: item, value: data[item], children: [] });
              } else {
                //区
                that.block.push({ id: item, value: data[item] });
              }
            }
            // 分类市级
            for (var index in that.province) {
              for (var index1 in that.city) {
                if (
                  that.province[index].id.slice(0, 2) ===
                  that.city[index1].id.slice(0, 2)
                ) {
                  that.province[index].children.push(that.city[index1]);
                }
              }
            }
            // 分类区级
            for (var item1 in that.city) {
              for (var item2 in that.block) {
                if (
                  that.block[item2].id.slice(0, 4) ===
                  that.city[item1].id.slice(0, 4)
                ) {
                  that.city[item1].children.push(that.block[item2]);
                }
              }
            }
            // console.info("sheng");
            // //console.log(that.province);
            // //console.log(that.city);
            // //console.log(that.block);
          } else {
            //console.log(response.status);
          }
        })
        .catch(function(error) {
          //console.log(typeof +error);
        });
    },
    getJurisdiction() {
      axios({
        method: "get",
        url: this.IP.IP + "/personInfo/getPermission"
      }).then(result => {
        this.jurisdiction = result.data.data;
        // console.log("权限", this.jurisdiction);
        var i = 0;
        var judge1 = 0;
        var judge2 = 0;
        for (i; i < this.jurisdiction.length; i++) {
          if (this.jurisdiction[i] == "归档") {
            judge1 = 1;
          }
          if (this.jurisdiction[i] == "管理") {
            judge2 = 1;
          }
        }
        if (judge1 == 1 && judge2 == 1) {
          this.jurisdictionNo = 3;
        } else if (judge1 != 1 && judge2 == 1) {
          this.jurisdictionNo = 2;
        } else if (judge1 == 1 && judge2 != 1) {
          this.jurisdictionNo = 1;
        } else {
          this.jurisdictionNo = -1;
        }
        // console.log("数字权限", this.jurisdictionNo);
        this.handleJurisdiction();
      });
    },
    //处理操作的disabled
    handleJurisdiction() {
      if (this.jurisdictionNo >= 1) {
        this.exportBton = false;
        this.easySearchBton = false;
        this.highWinButton = false;
        this.highSearchBton = false;
      } else {
        this.exportBton = true;
        this.easySearchBton = true;
        this.highWinButton = true;
        this.highSearchBton = true;
      }
    },
    chancelPaper() {
      axios({
        method: "post",
        url: this.IP.IP + "/archive/undoPaperyArchive?projectId=" + this.row
      }).then(result => {
        //console.log(result);
        var code = "";
        code = result.data.code;
        var msg = result.data.msg;
        if (code == 0) {
          this.$Message.success("撤销纸质归档成功");
          this.getNewData1();
        } else {
          this.$Message.error(msg);
        }
      });
    },
    chancelElect() {
      axios({
        method: "post",
        url: this.IP.IP + "/archive/undoElectricArchive?projectId=" + this.row
      }).then(result => {
        //console.log(result);
        var code = "";
        code = result.data.code;
        var msg = result.data.msg;
        if (code == 0) {
          this.$Message.success("撤销纸质归档成功");
          this.getNewData1();
        } else {
          this.$Message.error(msg);
        }
      });
    },
    downloadGrade(data) {
      if (!data) {
        return;
      }
      var blob = new Blob([data], {
        type:
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
      });
      var url = window.URL.createObjectURL(data.data);
      var aLink = document.createElement("a");
      aLink.style.display = "none";
      aLink.href = url;
      aLink.setAttribute("download", "projectGradet.xls");
      document.body.appendChild(aLink);
      aLink.click();
      document.body.removeChild(aLink); //下载完成移除元素
      window.URL.revokeObjectURL(url);
    },
    realExportGrade() {
      // console.info("ids");
      //console.log(this.ids);
      axios({
        method: "post",
        url: this.IP.IP + "/archive/exportAchieve",
        data: {
          ids: this.ids
        },
        responseType: "blob"
      })
        .then(result => {
          // console.info("zong");
          //console.log(result);
          this.downloadGrade(result);
          this.ids = [];
          this.undertakeDPListName = null;
          this.undertakePRListName = null;
          this.regDate = null;
          this.selectId = [];
          this.$Spin.hide();
        })
        .catch(error => {});
    },
    exportGrade() {
      this.$Spin.show({
        render: h => {
          return h("div", [
            h("Icon", {
              class: "demo-spin-icon-load",
              props: {
                type: "ios-loading",
                size: 18
              }
            }),
            h("div", "Loading")
          ]);
        }
      });
      if (this.selectId.length > 0) {
        var i = 0;
        for (i = 0; i < this.selectId.length; i++) {
          this.ids.push(this.selectId[i].id);
        }
        // console.info("1");
        //console.log(this.ids);
        //this.setTreeCondition();
        this.realExportGrade();
      } else {
        this.$ajax({
          method: "post",
          url: this.IP.IP + "/table/superSearchIds",
          data: {
            equalConditions: this.equalConditions,
            rangeConditions: this.rangeConditions,
            specialConditions: this.specialConditions
            //keyWord:this.keyword
          }
        }).then(result => {
          // console.info("2");
          //console.log(result.data.data)
          this.ids = result.data.data;
          //this.setTreeCondition();
          this.realExportGrade();
        });
      }
    },
    downloadTask(data) {
      if (!data) {
        return;
      }
      var blob = new Blob([data], {
        type:
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
      });
      var url = window.URL.createObjectURL(data.data);
      var aLink = document.createElement("a");
      aLink.style.display = "none";
      aLink.href = url;
      aLink.setAttribute("download", "projectTask.xls");
      document.body.appendChild(aLink);
      aLink.click();
      document.body.removeChild(aLink); //下载完成移除元素
      window.URL.revokeObjectURL(url);
    },
    realExportTask() {
      // console.info("ids");
      //console.log(this.ids);
      axios({
        method: "post",
        url: this.IP.IP + "/archive/exportTask",
        data: {
          ids: this.ids
        },
        responseType: "blob"
      })
        .then(result => {
          // console.info("zong");
          //console.log(result);
          this.downloadTask(result);
          this.ids = [];
          this.undertakeDPListName = null;
          this.undertakePRListName = null;
          this.regDate = null;
          this.selectId = [];
          this.$Spin.hide();
        })
        .catch(error => {});
    },
    exportTask() {
      this.$Spin.show({
        render: h => {
          return h("div", [
            h("Icon", {
              class: "demo-spin-icon-load",
              props: {
                type: "ios-loading",
                size: 18
              }
            }),
            h("div", "Loading")
          ]);
        }
      });
      if (this.selectId.length > 0) {
        var i = 0;
        for (i = 0; i < this.selectId.length; i++) {
          this.ids.push(this.selectId[i].id);
        }
        // console.info("1");
        //console.log(this.ids);
        //this.setTreeCondition();
        this.realExportTask();
      } else {
        this.$ajax({
          method: "post",
          url: this.IP.IP + "/table/superSearchIds",
          data: {
            equalConditions: this.equalConditions,
            rangeConditions: this.rangeConditions,
            specialConditions: this.specialConditions
            //keyWord:this.keyword
          }
        }).then(result => {
          // console.info("2");
          //console.log(result.data.data)
          this.ids = result.data.data;
          //this.setTreeCondition();
          this.realExportTask();
        });
      }
    },
    selectChange: function(data) {
      //console.log(data);
      this.selectId = data;
    },
    downloadProject(data) {
      if (!data) {
        return;
      }
      var blob = new Blob([data], {
        type:
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
      });
      var url = window.URL.createObjectURL(data.data);
      var aLink = document.createElement("a");
      aLink.style.display = "none";
      aLink.href = url;
      aLink.setAttribute("download", "project.xls");
      document.body.appendChild(aLink);
      aLink.click();
      document.body.removeChild(aLink); //下载完成移除元素
      window.URL.revokeObjectURL(url);
    },
    realExportProject() {
      // console.info("ids");
      //console.log(this.ids);
      axios({
        method: "post",
        url: this.IP.IP + "/archive/exportAnnualReturn",
        data: {
          ids: this.ids,
          time: this.regDate
        },
        responseType: "blob"
      })
        .then(result => {
          // console.info("zong");
          //console.log(result);
          this.downloadProject(result);
          this.ids = [];
          this.undertakeDPListName = null;
          this.undertakePRListName = null;
          this.regDate = null;
          this.selectId = [];
          this.$Spin.hide();
        })
        .catch(error => {});
    },
    exportProject() {
      this.$Spin.show({
        render: h => {
          return h("div", [
            h("Icon", {
              class: "demo-spin-icon-load",
              props: {
                type: "ios-loading",
                size: 18
              }
            }),
            h("div", "Loading")
          ]);
        }
      });
      if (this.selectId.length > 0) {
        var i = 0;
        for (i = 0; i < this.selectId.length; i++) {
          this.ids.push(this.selectId[i].id);
        }
        // console.info("1");
        //console.log(this.ids);
        this.setTreeCondition();
        this.realExportProject();
      } else {
        this.$ajax({
          method: "post",
          url: this.IP.IP + "/table/superSearchIds",
          data: {
            equalConditions: this.equalConditions,
            rangeConditions: this.rangeConditions,
            specialConditions: this.specialConditions
            //keyWord:this.keyword
          }
        }).then(result => {
          // console.info("2");
          //console.log(result.data.data)
          this.ids = result.data.data;
          this.setTreeCondition();
          this.realExportProject();
        });
      }
    },
    setTreeCondition() {
      //console.log("验证部门id"+this.valueId);
      if (this.valueId != 0) {
        axios({
          method: "get",
          url:
            this.IP.IP + "/searchForDepartmentById?departmentId=" + this.valueId
        }).then(result => {
          // console.info("打印部门名字");
          //console.log(result);
          this.undertakeDPListName = result.data.data.name;
          //console.log(this.undertakeDPListName+"111222");
        });
      } else {
        this.undertakeDPListName = "全部";
        this.undertakePRListName = "全部";
      }
      if (this.rangeConditions[2].sta) {
        this.regDate = this.rangeConditions[2].sta;
      } else if (!this.rangeConditions[2].end) {
        this.regDate = "全部";
      }
      if (this.rangeConditions[2].end) {
        this.regDate = this.regDate + "至" + this.rangeConditions[2].end;
      }
    },
    DateToString(date) {
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var day = date.getDate();
      if (month < 10) {
        var newmonth = "0" + month;
        month = newmonth;
      }
      if (day < 10) {
        var newday = "0" + day;
        day = newday;
      }
      var sDate = year + "-" + month + "-" + day;
      return sDate;
    },
    setConditionNull() {
      var i = 0;
      if (!this.keyword) {
        this.keyword = null;
      }
      for (i = 0; i < this.rangeConditions.length; i++) {
        if (!this.rangeConditions[i].sta) {
          this.rangeConditions[i].sta = null;
        }
        if (!this.rangeConditions[i].end) {
          this.rangeConditions[i].end = null;
        }
      }
      for (i = 0; i < this.rangeConditions.length; i++) {
        if (this.rangeConditions[i].sta) {
          this.rangeConditions[i].sta = this.DateToString(
            this.rangeConditions[i].sta
          );
        }
        if (this.rangeConditions[i].end) {
          this.rangeConditions[i].end = this.DateToString(
            this.rangeConditions[i].end
          );
        }
      }
      if (!this.equalConditions.developmentOrganization) {
        //建设单位
        this.equalConditions.developmentOrganization = null;
      }

      if (!this.equalConditions.hasArchived) {
        //归档状态
        if (this.equalConditions.hasArchived != 0) {
          this.equalConditions.hasArchived = null;
        }
      }

      if (!this.equalConditions.name) {
        //项目名称
        this.equalConditions.name = null;
      }

      if (!this.equalConditions.province) {
        //省
        this.equalConditions.province = null;
      }
      if (!this.equalConditions.city) {
        //市
        this.equalConditions.city = null;
      }
      if (!this.equalConditions.area) {
        //区
        this.equalConditions.area = null;
      }
      if (!this.equalConditions.type) {
        //项目类别
        this.equalConditions.type = null;
      }
      if (!this.equalConditions.industryType) {
        //行业类别
        this.equalConditions.industryType = null;
      }

      if (!this.equalConditions.hasUsualSealed) {
        //盖章状态
        if (this.equalConditions.hasUsualSealed != 0) {
          this.equalConditions.hasUsualSealed = null;
        }
      }
      if (!this.equalConditions.hasContract) {
        //合同有无
        if (this.equalConditions.hasContract != 0) {
          this.equalConditions.hasContract = null;
        }
      }
      if (!this.equalConditions.finishDepartmentId) {
        //完成部门
        this.equalConditions.finishDepartmentId = null;
      }
      if (!this.equalConditions.undertakePersonId) {
        //承接人id
        this.equalConditions.undertakePersonId = null;
      }
      if (!this.equalConditions.auditDepartment) {
        //审批部门
        this.equalConditions.auditDepartment = null;
      }
      if (!this.equalConditions.taskNumber) {
        //任务单编号
        this.equalConditions.taskNumber = null;
      }
      if (!this.equalConditions.contractOrigin) {
        //合同归属单位
        this.equalConditions.contractOrigin = null;
      }
      if (!this.equalConditions.editPersonId) {
        //编制人id
        this.equalConditions.editPersonId = null;
      }
      if (!this.equalConditions.principleId) {
        //负责id
        this.equalConditions.principleId = null;
      }
    },
    addSpecial() {
      this.specialConditions = [];
      if (this.spBackFile) {
        this.specialConditions.push(
          "(paperyArchiverId=" +
            this.spBackFile +
            " or electricArchiverId=" +
            this.spBackFile +
            ")"
        );
      }
    },
    ClearCondition() {
      var i = 0;
      this.keyword = null;
      for (i = 0; i < this.rangeConditions.length; i++) {
        this.rangeConditions[i].sta = null;
        this.rangeConditions[i].end = null;
      }
      this.equalConditions.name = null;
      this.equalConditions.type = null;
      this.equalConditions.undertakePersonId = null;
      this.equalConditions.finishDepartmentId = null;
      this.equalConditions.auditDepartment = null;
      this.equalConditions.province = null;
      this.equalConditions.city = null;
      this.equalConditions.area = null;
      this.equalConditions.taskNumber = null;
      this.equalConditions.industryType = null;
      this.equalConditions.contractOrigin = null;
      this.equalConditions.hasUsualSealed = null;
      this.equalConditions.hasArchived = null;
      this.equalConditions.hasContract = null;
      this.equalConditions.editPersonId = null;
      this.equalConditions.developmentOrganization = null;
      this.equalConditions.principleId = null;

      this.specialConditions = [];
      this.spBackFile = null;
    },
    OpenhihgLevelSearch() {
      this.fileHigh = true;
    },
    HighClear() {
      this.ClearCondition();
      this.clearHigh = false;
    },
    cancelAdd() {
      this.fileHigh = false;
    },
    checkAdd1() {
      this.setConditionNull(); //空字符串变null
      this.addSpecial();
      this.fileHigh = false;
      this.clearHigh = true;
    },
    checkAdd(name) {
      //高级查询点确定
      // console.info("equal");
      // console.log(this.equalConditions);
      this.$refs[name].validate(valid => {
        if (valid) {
          this.setConditionNull(); //空字符串变null
          this.addSpecial();
          this.fileHigh = false;
          this.clearHigh = true;
        } else {
          this.$Message.error("格式错误!");
        }
      });
    },
    hihgLevelSearch() {
      var u = this.IP.IP + "/table/superSearch";
      if (this.keyword) {
        u = this.IP.IP + "/table/superSearch?keyWord=" + this.keyword;
        this.checkAdd1();
      }
      this.pageNum = 1;
      this.$ajax({
        method: "post",
        url: u,
        params: {
          pageNum: this.pageNum,
          pageSize: 10,
          modelId: 6
        },
        data: {
          equalConditions: this.equalConditions,
          rangeConditions: this.rangeConditions,
          specialConditions: this.specialConditions
        }
      }).then(result => {
        // console.info("高级查询结果");
        // console.log(result);
        if (result.data.code == 0) {
          this.data = result.data.data.data.list;
          var total = result.data.data.data.total;
          this.totalDataNo = total;
        } else {
          this.data = [];
          var msg = result.data.msg;
          this.$Message.error(msg);
        }
      });
    },
    hihgLevelSearch1() {
      var u = this.IP.IP + "/table/superSearch";
      if (this.keyword) {
        u = this.IP.IP + "/table/superSearch?keyWord=" + this.keyword;
      }
      this.$ajax({
        method: "post",
        url: u,
        params: {
          pageNum: this.pageNum,
          pageSize: 10,
          modelId: 6
        },
        data: {
          equalConditions: this.equalConditions,
          rangeConditions: this.rangeConditions,
          specialConditions: this.specialConditions
        }
      }).then(result => {
        if (result.data.code == 0) {
          // console.info("高级查询结果");
          //console.log(result);
          this.data = result.data.data.data.list;
          //  var total = result.data.data.data.total;
          //  this.totalDataNo = total;
        } else {
          this.data = [];
          var msg = result.data.msg;
          this.$Message.error(msg);
        }
      });
    },
    getBackFilePeo() {
      axios({
        method: "get",
        url: this.IP.IP + "/personInfo/getArchivePerson"
      }).then(result => {
        var total = result.data.data.length;
        var list = result.data.data;
        for (var i = 0; i < total; i++) {
          this.backFileList.push({
            id: list[i].personId + "",
            name: list[i].personName + ""
          });
        }
        // console.info("归档人名单");
        //console.log(this.backFileList);
      });
    },
    insertPeo() {
      // console.info("insetr");
      //console.log(this.allPeoPages);
      var i = 1;
      for (i = 1; i <= this.allPeoPages; i++) {
        axios({
          method: "get",
          url: this.IP.IP + "/personInfo/show?pageNum=" + i + "&pageSize=" + 10
        }).then(result => {
          var total = result.data.data.list.length;
          var list = result.data.data.list;
          // console.info("lentgh");
          // console.info(total);
          //console.log(list);
          for (var j = 0; j < total; j++) {
            this.allPeo.push({
              id: list[j].id + "",
              name: list[j].name + ""
            });
            // console.info(i);
            // //console.log(this.allPeo);
          }
        });
      }
      // console.info("所有人名单");
      //console.log(this.allPeo);
    },
    getAllPeo() {
      axios({
        method: "get",
        url: this.IP.IP + "/personInfo/show?pageNum=" + 1 + "&pageSize=" + 10
      }).then(result => {
        this.allPeoPages = result.data.data.pages;
        // console.info("pages111");
        //console.log(this.allPeoPages);
        this.insertPeo();
      });
      //this.insertPeo();
    },
    getEditpersonList() {
      axios({
        method: "get",
        url: this.IP.IP + "/personInfo/getEditPerson"
      }).then(result => {
        var total = result.data.data.length;
        var list = result.data.data;
        for (var i = 0; i < total; i++) {
          this.editPerList.push({
            id: list[i].personId + "",
            name: list[i].personName + ""
          });
        }
        // console.info("编制人名单");
        //console.log(this.editPerList);
      });
    },
    getCarerType() {
      axios({
        method: "get",
        url: this.IP.IP + "/getIndustryTypes?pageNumber=" + 1
      }).then(result => {
        var total = result.data.data.total;
        var list = result.data.data.list;
        for (var i = 0; i < total; i++) {
          this.carerType.push({
            id: list[i].id + "",
            name: list[i].name + ""
          });
        }
        // console.info("行业类别名单");
        //console.log(this.carerType);
      });
    },
    getproType() {
      axios({
        method: "get",
        url: this.IP.IP + "/getProjectTypes?pageNumber=" + 1
      }).then(result => {
        var total = result.data.data.total;
        var list = result.data.data.list;
        for (var i = 0; i < total; i++) {
          this.proType.push({
            id: list[i].id + "",
            name: list[i].name + ""
          });
        }
        // console.info("项目类别");
        //console.log(this.proType);
      });
    },

    getpageNum(e) {
      // console.info("当前页");
      //console.log(e);
      this.pageNum = e;
      if (this.clearHigh) {
        this.hihgLevelSearch1();
      } else {
        this.getNewData1();
      }
    },
    getdepartments() {
      axios({
        method: "get",
        url: this.IP.IP + "/getDepartments"
      }).then(result => {
        // console.info("部门信息");
        //console.log(result);
        var data = result.data.data;
        this.dataTree = [];
        var i = 0;
        for (i = 0; i < data.length; i++) {
          this.setNode(data[i]);
        }
        this.dataTree = data;
        this.dataTree.unshift({ id: 0, name: "全部", children: [] });
        // console.info("部门树");
        //console.log(this.dataTree);
        //console.info('')
        ////console.log(this.valueId);
      });
    },
    setNode(node) {
      if (node != null) {
        node.name = node.nodeDepartmentIndex.name;
        node.id = node.nodeDepartmentIndex.id;
        node.children = node.childrenDepartmentIndexes;
        this.dptList.push({
          id: node.id + "",
          name: node.name
        });
        var i = 0;
        for (i = 0; i < node.childrenDepartmentIndexes.length; i++) {
          this.setNode(node.childrenDepartmentIndexes[i]);
        }
      }
    },
    getpersonPage() {
      axios({
        method: "get",
        url:
          this.IP.IP +
          "/getDepartmentsConsistent?departmentId=" +
          this.valueId +
          "&pageNumber=1&pageSize=5"
      }).then(result => {
        //this.personName = result.data.data.list;
        if (result.data.code == 0) {
          this.perNo = result.data.data.pages;
          // console.info("页数");
          //console.log(this.perNo);
          this.getperson();
        }
      });
    },
    getperson() {
      var i = 0;
      for (i = 1; i <= this.perNo; i++) {
        axios({
          method: "get",
          url:
            this.IP.IP +
            "/getDepartmentsConsistent?departmentId=" +
            this.valueId +
            "&pageNumber=" +
            i +
            "&pageSize=5"
        }).then(result => {
          var size = result.data.data.size;
          var list = result.data.data.list;
          this.personName = this.personName.concat(list);
        });
      }
      //this.personName.unshift({ id: 0, name: "全部" });
      // console.info("人员名单");
      //console.log(this.personName);
    },
    getperId(e) {
      //console.log(e);
      this.valueId2 = e.value;
      // console.info("选中人员ID");
      //console.log(this.valueId2);
      // console.info("部门选择不是全部的MOdal1的值");
      //console.log(this.model1);
    },
    getValue(value) {
      this.valueId = value;
      //console.log(this.valueId);
      //this.personName = [];
      if (this.valueId != 0) {
        this.personName = [{ id: 0, name: "全部" }];
        this.getpersonPage();
      } else {
        this.model1 = 0;
        this.personName = [{ id: 0, name: "全部" }];
      }
    },
    getNowYear() {
      var date = new Date();
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var day = date.getDate();
      if (month < 10) {
        var newmonth = "0" + month;
        month = newmonth;
      }
      if (day < 10) {
        var newday = "0" + day;
        day = newday;
      }
      var sDate = year + "-" + month + "-" + day;
      this.nowyear = year;
      this.nowDate = sDate;
      // console.info("当前年");
      //console.log(this.nowyear);
      //console.log(this.nowDate);
      for (var i = 2005; i <= this.nowyear; i++) {
        this.yearName.push({ id: i, name: i + "" });
      }
      this.yearName.unshift({ id: 0, name: "全部" });
      // console.info("年份数组");
      //console.log(this.yearName);
    },
    getyear(e) {
      //console.log(this.model2);
    },
    //select获取选择的data全部信息

    getNewData1() {
      this.data = [];
      if (this.valueId != 0) {
        this.select1 = this.valueId;
      }
      if (this.model1 != 0) {
        this.select2 = this.model1;
      }
      if (this.model2 != 0) {
        this.select3 = this.model2 + "";
      }
      // console.info("select123");
      //console.log(this.select1);
      //console.log(this.select2);
      //console.log(this.select3);
      this.$ajax({
        method: "post",
        url: this.IP.IP + "/table/show",
        params: {
          pageNum: this.pageNum,
          pageSize: 10,
          modelId: 6
        },
        data: {
          undertakePersonId: this.select2,
          undertakeDepartmentId: this.select1,
          registDate: this.select3
        }
      }).then(response => {
        this.data = response.data.data.data.list;
        //console.info('111');
        ////console.log(fields);
        // var total = response.data.data.data.total;
        // this.totalDataNo = total;
        // console.info("total");
        // //console.log(this.totalDataNo);
        this.select1 = null;
        this.select2 = null;
        this.select3 = null;
      });
    },
    getNewData() {
      this.data = [];
      if (this.valueId != 0) {
        this.select1 = this.valueId;
      }
      if (this.model1 != 0) {
        this.select2 = this.model1;
      }
      if (this.model2 != 0) {
        this.select3 = this.model2 + "";
      }
      // console.info("select123");
      //console.log(this.select1);
      //console.log(this.select2);
      //console.log(this.select3);
      this.$ajax({
        method: "post",
        url: this.IP.IP + "/table/show",
        params: {
          pageNum: 1,
          pageSize: 10,
          modelId: 6
        },
        data: {
          undertakePersonId: this.select2,
          undertakeDepartmentId: this.select1,
          registDate: this.select3
        }
      }).then(response => {
        this.data = response.data.data.data.list;
        //console.info('111');
        ////console.log(fields);
        var total = response.data.data.data.total;
        this.totalDataNo = total;
        // console.info("total");
        //console.log(this.totalDataNo);
        this.select1 = null;
        this.select2 = null;
        this.select3 = null;
      });
    },

    setBackdata(st) {
      //console.log(this.row);
      this.callbackdata = this.row;
      this.callbackState = st;
    },
    getcolumns() {
      axios({
        method: "post",
        url:
          this.IP.IP +
          "/table/show?pageNum=" +
          this.pageNum +
          "&pageSize=" +
          this.pageSize +
          "&modelId=" +
          this.modelId
      }).then(result => {
        let that = this;

        var fields = result.data.data.fields;
        var attribute = result.data.data.attribute;
        //var list=result.data.data.data.list;
        var i = 0;
        //console.log(result);
        for (i; i < fields.length; i++) {
          this.columns.push({
            title: fields[i],
            width: 120,
            key: attribute[i]
          });
        }
        //this.data=list;
      });
    },
    getTable() {
      axios({
        method: "post",
        url:
          this.IP.IP +
          "/table/show?pageNum=" +
          this.pageNum +
          "&pageSize=" +
          this.pageSize +
          "&modelId=" +
          this.modelId
      }).then(result => {
        let that = this;
        var list = result.data.data.data.list;
        //var i=0;
        //console.log(result);
        this.data = list;
      });
    },
    closefiledtail() {
      let that = this;
      this.$Modal.confirm({
        title: "确定关闭吗？",
        onOk() {
          that.fileDtail = false;
        }
      });
    },
    comfirmRemark() {
      //console.log(this.remark);
      axios({
        method: "post",
        url:
          this.IP.IP +
          "/archive/remark?projectId=" +
          this.row +
          "&remark=" +
          this.remark
      }).then(result => {
        //console.log(result);
        var code = "";
        code = result.data.code;
        var msg = result.data.msg;
        if (code == 0) {
          this.$Message.success("添加备注成功");
          this.remark = null;
        } else {
          this.$Message.error(msg);
          this.remark = null;
        }
        this.remarkModal = false;
      });
    },
    remarkCancel() {
      this.remark = "";
      this.remarkModal = false;
    },
    comfirmFile() {
      //请求后台
      if (this.isPaper) {
        //当为纸质归档时
        axios({
          method: "get",
          url:
            this.IP.IP +
            "/archive/paperyArchive?projectId=" +
            this.row +
            "&archiverId=" +
            this.fileMan
        }).then(result => {
          //console.log(result);
          var code = "";
          code = result.data.code;
          var msg = result.data.msg;
          if (code == 0) {
            this.$Message.success("纸质归档成功");
            this.getNewData1();
          } else {
            this.$Message.error(msg);
          }
          this.fileModal = false;
        });
      } else {
        //当为电子归档时
        axios({
          method: "get",
          url:
            this.IP.IP +
            "/archive/electricArchive?projectId=" +
            this.row +
            "&archiverId=" +
            this.fileMan
        }).then(result => {
          //console.log(result);
          var code = "";
          code = result.data.code;
          var msg = result.data.msg;
          if (code == 0) {
            this.$Message.success("电子归档成功");
            this.getNewData1();
          } else {
            this.$Message.error(msg);
          }
          this.fileModal = false;
        });
      }
      this.fileMan = null;
    },
    fileCancel() {
      this.fileMan = null;
    },
    comfirmNumber() {
      //console.log(this.number);
      axios({
        method: "post",
        url:
          this.IP.IP +
          "/archive/addFileNumber?projectId=" +
          this.row +
          "&fileNumber=" +
          this.number
      }).then(result => {
        //console.log(result);
        var code = "";
        code = result.data.code;
        var msg = result.data.msg;
        if (code == 0) {
          this.$Message.success("添加档案号成功");
          this.number = null;
        } else {
          this.$Message.error(msg);
          this.number = null;
        }
        this.numberModal = false;
      });
    },
    numberCancel() {
      this.number = "";
      this.numberModal = false;
    }
  }
};
</script>

<style>
.top-button-group {
  padding: 5px;
}
.search-bar {
  width: 100%;
}
.search-block {
  padding: 5px;
  display: inline-block;
  width: 300px;
  height: 50px;
}
.search-block span {
  line-height: 50px;
}
.search-block .ivu-select {
  width: 150px;
}
.senior-search-block {
  height: 50px;
  padding: 5px;
}
.search-content {
  width: 200px;
}
</style>